<!-- 项目审批信息 -->
<template>
  <TCollapse v-if="+showType" title="项目审批信息">
    <iframe :src="taskDetailsUrl" scrolling="no" width="100%" :height="taskHeight" frameborder="0" />
  </TCollapse>
  <iframe v-else :src="taskDetailsUrl" scrolling="no" width="100%" :height="taskHeight" frameborder="0" />
</template>
<script>

import TCollapse from '@/components/basic/TCollapse.vue'

export default {
  name: 'JnTaskDetail',
  components: { TCollapse },
  props: {
    processInstId: {
      type: [Number, String],
      default: 0
    },
    showType: {
        type: String,
        default: '1'
    }
  },
  data() {
    return {
      taskHeight: ''
    }
  },
  computed: {
    taskDetailsUrl() {
      return `${process.env.VUE_APP_JUNNAN_IFRAME_URL}workflow/taskDetail/handleOnlyRecord?processInstID=${this.processInstId}`
    }
  },
  async created() {
    window.addEventListener('message', (event) => {
      const base_url = ''
      if (event.origin === base_url) {
        return
      }
      if (event.data.type === 'commentHeight') {
        console.log('项目审批信息', event.data)
        this.taskHeight = event.data.data
      }
    })
  }
}
</script>

<style scoped lang='scss'>
</style>
